<?php
	
class Table_Realisateurs extends Zend_Db_Table_Abstract
{
    protected $_name    = 'realisateur';
    protected $_primary = 'VIP_NUMERO';
    protected $_sequence = true; //la table a un autoincrément
 	
    
	public function isRealisateur($numVip){
		return $this->fetchRow($this->select()
									->where('VIP_NUMERO = ? ', $numVip)
				);
	}
	
	public function getFilmsByNum($numVip){
		$req= $this->select()
									->setIntegrityCheck(false)
									->from(array('f'=>'film'),
									array('FILM_TITRE', 'FILM_DATEREALISATION'))
									->where('f.VIP_NUMERO = ?', $numVip)
									->distinct();
		$resu=$this->fetchAll($req);
		return $resu;
	}
	
	public function addRealisateur($numvip){
		$data = array('VIP_NUMERO'=> $numvip);
		$this->insert($data);
	}
	
	public function deleteVip($numvip){
		$this->delete('VIP_NUMERO = '.$numvip);
	}
}